home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Personal Computer World 2009 February
/
PCWFEB09.iso
/
Software
/
Resources
/
Chat & Communication
/
Digsby build 37
/
digsby_setup.exe
/
lib
/
pyxmpp
/
objects.pyo
(
.txt
)
< prev
next >
Wrap
Python Compiled Bytecode
|
2008-10-13
|
2KB
|
90 lines
# Source Generated with Decompyle++
# File: in.pyo (Python 2.5)
__revision__ = '$Id: objects.py 647 2006-08-26 18:27:39Z jajcus $'
__docformat__ = 'restructuredtext en'
import libxml2
from pyxmpp.xmlextra import common_doc
class StanzaPayloadObject(object):
xml_element_name = None
xml_element_namespace = None
def as_xml(self, parent = None, doc = None):
if parent:
if not doc:
n = parent
while n:
if n.type == 'xml_document':
doc = n
break
n = n.parent
if not doc:
doc = common_doc
try:
ns = parent.searchNsByHref(doc, self.xml_element_namespace)
except libxml2.treeError:
ns = None
xmlnode = parent.newChild(ns, self.xml_element_name, None)
if not ns:
ns = xmlnode.newNs(self.xml_element_namespace, None)
xmlnode.setNs(ns)
doc1 = doc
elif doc:
doc1 = doc
else:
doc1 = libxml2.newDoc('1.0')
xmlnode = doc1.newChild(None, self.xml_element_name, None)
ns = xmlnode.newNs(self.xml_element_namespace, None)
xmlnode.setNs(ns)
self.complete_xml_element(xmlnode, doc1)
if doc or parent:
return xmlnode
doc1.setRootElement(xmlnode)
return doc1
def complete_xml_element(self, xmlnode, doc):
pass
class StanzaPayloadWrapperObject(object):
def as_xml(self, parent = None, doc = None):
if parent:
if not doc:
n = parent
while n:
if n.type == 'xml_document':
doc = n
break
n = n.parent
if not doc:
doc = common_doc
copy = self.xmlnode.docCopyNode(doc, True)
parent.addChild(copy)
return copy
elif not doc:
doc1 = libxml2.newDoc('1.0')
else:
doc1 = doc
xmlnode = doc1.addChild(self.xmlnode.docCopyNode(doc, True))
doc1.setRootElement(xmlnode)
if doc:
return xmlnode
return doc1